close all;clc;clear all;

Fd = 44.2e6;     % [Hz]
Td = 1/Fd;     % [sec]
Tmod = 0.001;   % [sec]
t = 0:Td:Tmod-Td; % [sec]
f = 0:(1/Tmod):(1/Td - 1/Tmod);

% X = randn(1,length(t));

N_PRN = 1023; T_PRN = 0.001;
PRN = sign(randn(1, N_PRN));
ind_h = fix(mod(t/T_PRN, 1)*N_PRN) + 1;
h = PRN(ind_h);

A = 2;
f0 = 6e6;
phi = pi/4;

X = A * h .* cos(2*pi*f0*t + phi);
Sx = 20*log10(abs(fft(X)));
Sx = Sx - max(Sx) + 1;

filter_object = FIR();
 figure(1)
freqz(filter_object.Numerator, 1);

Y = filter(filter_object.Numerator,1,X);



Sy = 20*log10(abs(fft(Y)));
Sy = Sy - max(Sy) + 1;

figure(2)
subplot(2,1,1)
plot(f/1e6,Sx);
xlim([0 13]);
grid on;
subplot(2,1,2)
plot(f/1e6,Sy);
xlim([0 13]);
grid on;